package com.infotel.chat;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

import javax.xml.bind.DataBindingException;
import javax.xml.bind.JAXB;

public class ServeurChat {


    public static void main(String[] args) {
        Chat chat;
        try {
            @SuppressWarnings("resource")
            ServerSocket serveur = new ServerSocket(10000);
            try{
            chat = JAXB.unmarshal("C:\\a_workspace\\Multimedia\\src\\com\\infotel\\cha\\chat.xml", Chat.class);
            }catch (DataBindingException e) {
                System.out.println("erreur de lecture fichier xml");
                 chat = new Chat();
            } 
            final Chat finalChat = chat;
            while (true) {

                Socket socketServeur = serveur.accept();
                new ThreadServeur(socketServeur,finalChat).start();

            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } 

    }

}
